package com.ldn.server.mqtt.config;

import com.ldn.server.mqtt.config.annotation.ServerMqttServiceController;
import jakarta.validation.constraints.NotNull;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author 李大牛家的牛 (scafel@163.com)
 * @product serverless
 * @className MyMVCConfig
 * @createDate 2025/1/23 - 15:27
 * @description ToDo...
 **/
@Configuration
public class MqttServiceMVCConfig implements WebMvcConfigurer {

    @Override
    public void configurePathMatch(@NotNull PathMatchConfigurer configurer) {
        // 用于处理请求接口前缀
        configurer.addPathPrefix("mqtt-service", c -> c.isAnnotationPresent(ServerMqttServiceController.class));
        WebMvcConfigurer.super.configurePathMatch(configurer);
    }
}
